<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // class 用来声明类
    // constructor 用来声明构造函数

    class Phone {
      // 构造方法
      constructor(name, price) {
        this.name = name;
        this.price = price;
      }
      call() {
        console.log('打电话');
      }
    }

    let onePlus = new Phone('onePlus', 5000);

    console.log(onePlus);

  </script>
</body>

</html>